var conection_delete;
function loadFileDeleteFriend(url) 
{
  if(url=='')
  {
        return;
  }
  
  conection_delete=postRequest();
  conection_delete.onreadystatechange = procesarEventosDF;
  //conection_delete.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
  conection_delete.open("GET", url, true);
  conection_delete.send(null);
}

function procesarEventosDF()
{
	
  if(conection_delete.readyState == 4)
  {
	  deleted(conection_delete.responseText);
  } 
}   
        function deleted(str){
            if(str=="yes"){
        	alert('Eliminado ');
        	init_user_friends();
        	init_users_petitions();
        	init_users();
        	}else{
				alert('No eliminado');
            }
        }
        
        function delete_friend(formname){
        	resp=window.confirm("DESEA ELIMINAR") 
    		if(resp) 
    		{  
    			var id = document.forms[formname].elements['id'].value;
		        var user_id = document.forms[formname].elements['user_id'].value;
    		    var url = "delete_friend.php?id="+id+"&user_id="+user_id ;
    		    loadFileDeleteFriend(url);
    		}
    		else
    			return false;	       
        }	
           